const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');

module.exports = {
	mode:'development',
	entry:path.join(__dirname,'./src/main.js'),
	output:{
		path:path.join(__dirname,'./dist'),
		filename:'bundle.js'
	},
	plugins:[
    new htmlWebpackPlugin({
    	template:path.join(__dirname,'./src/index.html'),
    	filename:'index.html'
    }),
     new VueLoaderPlugin()
	],
	module:{//这个节点用于匹配第三方加载器
		rules:[//匹配规则
       {test:/\.css$/,use:['style-loader','css-loader']},
       {test:/\.less$/,use:['style-loader','css-loader','less-loader']},
       {test:/\.scss$/,use:['style-loader','css-loader','sass-loader']},
       {test:/\.(png|jpg|jpeg|bmp)$/,use:'url-loader?limit=179999&name=[hash:8][name].[ext]'},//limit是限制字节大小，hash是匹配前八个的哈希值，哈希总共有32位name是修改文件名
	   {test:/\.(ttf|svg|eot|woff|woff2)$/,use:'url-loader'},
	   {test:/\.js$/,use:'babel-loader',exclude:/node_modules/},//这里是排除node_modules之外，一定要排除
	   {test:/\.vue$/,use:'vue-loader'}
		]//如果是小于limit的值就会转化为base64位的字符串

	},
	resolve:{
		alias:{
			// "vue$":'vue/dist/vue.js'
		}
	}
}